import requests

'''
免费代理网址(站大爷)： https://www.zdaye.com/free/
'''

url = 'http://www.baidu.com/s?'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',

    'Cookie': 'BIDUPSID=F56C21D06BD742371B283C21F2438242; PSTM=1706440905; BAIDUID=01036CEB008DE2F59B611756BF86DC32:FG=1; BD_UPN=12314753; BDUSS_BFESS=VCUFp-NUpFZmJ0RzBzb0g1R3BTRnlmaGk0bkNINkpkN1YtbjdhN1lYN1o5c0ptSUFBQUFBJCQAAAAAAAAAAAEAAADEKueUsK5lYmlwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANlpm2bZaZtmeD; BDORZ=FFFB88E999055A3F8A630C64834BD6D0; H_PS_PSSID=60273_60566_60576_60359_60623; H_WISE_SIDS=60273_60566_60576_60359_60623; H_WISE_SIDS_BFESS=60273_60566_60576_60359_60623; ab_sr=1.0.1_MDljM2ZkY2YwOGU1MTAxOWNlODA5OTVjNTU0NTg1ODkyNGQwNzc2NTU3NWVmZGE4YWYwMjcwZWNiMjJiOTk5YWFiMTljYzM3ZjJiODgwZDY4MGIxOGEwZGE0MzQ4MDhlNjIxNDg3MTA0ZDFlNWRkZDY0OTYyZGU4MjhjYWFiNWVhNTRhYjA3MmNmM2EzN2VlNzVjMzExOTZmZGJmMWVmNA==; BAIDUID_BFESS=01036CEB008DE2F59B611756BF86DC32:FG=1; BD_CK_SAM=1; PSINO=7; delPer=0; COOKIE_SESSION=202_5_9_9_14_27_1_2_6_6_0_2_199_0_5_6_1723789101_1723363960_1723789096%7C9%232487_41_1723363954%7C8; BA_HECTOR=0haha184al240581052k2k0gajjm3p1jbu4mf1v; ZFY=i7:A3M:A2omBVTbEtLnlOvenx6yN4PtvH0JcbKGLL:AR8g:C; baikeVisitId=f502dc85-9b0e-428a-be7e-0a4f8527e64c; H_PS_645EC=523a8kX7WtqPLnbri3Ki1NB2u%2FUuLQdvT8DZcXxDvlP%2FcLDf6qN%2BDW%2BUQ751ut5zx57PJuI'
}

data = {
    'wd': 'ip'
}

# 代理声明
proxy = {
    'http':'47.106.184.252:8081'
}

# response = requests.get(url=url, params=data, headers=headers)
response = requests.get(url=url, params=data, headers=headers, proxies = proxy)
response.encoding = 'utf-8'
content = response.text
print(content)

# with open('dail.html', 'w', encoding='utf-8') as fp:
#     fp.write(content)

print('文件写入完毕。。。')
